package com.weaver.seconddev.api.tl.purchase_api;


import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import lombok.Data;

import java.util.List;

/**
 * 采购Po请求报文
 */
@Data
public class PoReqMessage {
    private PoHeader poHeader;
    private PoAddress poAddress;
    private List<PoHeaderText> poHeaderTextList;
    private List<PoItem> poItemList;
    private List<PoItemText> poItemTextList;
    private List<PoItemAddress> poItemAddressList;
    private List<PoAccount> poAccountList;
    private List<PoCondition> poConditionList;

    public String getRequestBody(){
        JSONObject message = new JSONObject();
        message.put("poHeader", poHeader);
        message.put("poAddress", poAddress);
        message.put("poHeaderTexts", poHeaderTextList);
        message.put("poItems", poItemList);
        message.put("poItemTexts", poItemTextList);
        message.put("poItemAddress", poItemAddressList);
        message.put("poAccounts", poAccountList);
        message.put("poConditions", poConditionList);
        return JSON.toJSONString(message, SerializerFeature.WriteNullStringAsEmpty);
    }
}
